package view;

import javafx.geometry.Pos;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Border;
import javafx.scene.layout.BorderStroke;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import logic.FileSystem;
import view.controller.PropertyWindowController;

public class PropertyWindow {
    public static void display(Parent root, PropertyWindowController controller, int index){
        Stage stage = new Stage();
        Scene scene = new Scene(root);
        stage.setTitle("磁盘块");
        FileSystem fileSystem = FileSystem.getInstance();

        for(int i=0;i<64;i++){
            Label label = new Label(String.valueOf(fileSystem.blocks[index].data[i]));
            if(i%16 == 14){
                char datum = fileSystem.blocks[index].data[i];
                if(datum>48) {
                    label.setText(String.valueOf((int) (fileSystem.blocks[index].data[i]) - 48));
                }
            }
            label.setPrefSize(60,40);
            label.setAlignment(Pos.CENTER);
            label.setTextFill(Color.GREEN);
            label.setStyle("-fx-border-color: black;-fx-border-width: 1px;-fx-font-size: 17");

            controller.getGrid().add(label,i%16,i/16);
        }


        stage.setScene(scene);
        stage.showAndWait();
    }
}
